﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Ctrl : MonoBehaviour
{
    [Header("操作按键")]
    [SerializeField] private KeyCode key_Attack;
    [SerializeField] private KeyCode key_Jump;
    [Space]

    private Behavior behavior;

    // Start is called before the first frame update
    void Start()
    {
        behavior = gameObject.GetComponent<Behavior>();
    }

    // Update is called once per frame
    void Update()
    {
        float x = Input.GetAxisRaw("Horizontal");
        behavior.Move(x);

        if (Input.GetKeyDown(key_Attack))
        {
            behavior.Attack();
        }

        if (Input.GetKeyDown(key_Jump))
        {
            behavior.Jump();
        }
    }
}
